﻿using System.Linq;
using BenchmarkDotNet.Attributes;
using TiffLibrary.Compression;
using TiffLibrary.Tests.CompressionTests;

namespace TiffLibrary.Benchmarks.Compression
{
    public class LzwCompression
    {
        [Params(0, 3, 6, 7, 10, 11)] // 0, 3, 6 - LSB, 7, 10, 11 - MSB
        public int Index { get; set; }

        private byte[] packed;
        private byte[] unpacked;

        [GlobalSetup]
        public void Setup()
        {
            var vars = LzwCompressionTests.GetLzwTestData().Skip(Index).First();

            packed = (byte[])vars[0];
            unpacked = (byte[])vars[1];
        }

        [Benchmark]
        public void Decompress()
        {
            LzwCompressionAlgorithm compression = LzwCompressionAlgorithm.Instance;
            compression.Decompress(null, packed, unpacked);
        }

    }
}
